class Animal{
    eat():void{
        console.log('动物吃食物');
    }
}
class Dog extends Animal{
    eat(): void {
        console.log('狗吃骨头');
    }
    catchFly(){
        console.log('狗可以和主人玩飞盘');
    }
}
class Panda extends Animal{
    eat(): void {
        console.log('熊猫吃竹子');
    }
    work(){
        console.log('我可以世界友人观赏');
    }
}

class Master{
    public peinum(animal:Animal){
        animal.eat()
        if(animal instanceof Dog){
            animal.catchFly()
        }else if(animal instanceof Panda){
            animal.work()
        }
    }
}

class TestMain{
    show(){
        const master=new Master()
        //master.peinum(new Dog())
        master.peinum(new Panda())
    }
}

new TestMain().show()